home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / pupworld.swf / scripts / __Packages / Heroes / Cat.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  1.3 KB  |  48 lines

  1. class Heroes.Cat extends Heroes.ConfusingMobileDistraction
  2. {
  3.    var hasDistracted;
  4.    var distractionRadius;
  5.    var oldDisRadius;
  6.    var oldWalkSpeed;
  7.    var dWalk;
  8.    var distractionWeight;
  9.    var x;
  10.    var dWalkM;
  11.    function Cat()
  12.    {
  13.       super();
  14.       this.hasDistracted = false;
  15.    }
  16.    function onLoad()
  17.    {
  18.       super.onLoad();
  19.       this.distractionRadius = 100;
  20.       this.oldDisRadius = this.distractionRadius;
  21.       this.oldWalkSpeed = this.dWalk;
  22.       this.distractionWeight = 3.9;
  23.    }
  24.    function distractPlayer()
  25.    {
  26.       super.distractPlayer();
  27.       trace("cat . distractPlayer");
  28.       this.state = "walking";
  29.       if(!this.hasDistracted)
  30.       {
  31.          this.distractionRadius *= 4;
  32.          this.hasDistracted = true;
  33.          trace("cat dwalk multi " + this.dWalk);
  34.          this.dWalk *= 6;
  35.          trace("dWalk=" + this.dWalk);
  36.          this.playSound("catrun");
  37.          ┬º┬ºpush(this._parent.player.x < this.x ? (this.dWalkM = 1, this.gotoAndStop("right")) : (this.dWalkM = -1, this.gotoAndStop("left")));
  38.       }
  39.    }
  40.    function onReset()
  41.    {
  42.       trace("onreset");
  43.       this.distractionRadius = this.oldDisRadius;
  44.       this.dWalk = this.oldWalkSpeed;
  45.       this.hasDistracted = false;
  46.    }
  47. }
  48.